package com.qianfeng.wuyang.himalaya.adapter.broadcastadapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import com.qianfeng.wuyang.himalaya.bean.broadcastbean.ProvinceListResultEntity;
import com.qianfeng.wuyang.himalaya.fragment.ProvinceBaseFragment;

import java.util.List;

/**
 * Created by wuyang on 2016/12/7.
 */

public class ProvinceFragmentPagerAdapter extends FragmentPagerAdapter{

    private List<ProvinceListResultEntity> list;

    public ProvinceFragmentPagerAdapter(FragmentManager fm, List<ProvinceListResultEntity> list) {
        super(fm);
        this.list = list;
    }

    @Override
    public Fragment getItem(int position) {
        return ProvinceBaseFragment.newInstance(list.get(position).getProvinceCode());
    }

    @Override
    public int getCount() {
        return list.size();
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return list.get(position).getProvinceName();
    }
}
